/*localStorage的方法 
    存： localStorage.setItem('key',value)
    取:  localStorage.getItem('key')
    删:  localStorage.removeItem('key')
    清空：localStorage.celar()
*/

const token = 'hmnews-token'

// 存
const saveToken = obj => {
    localStorage.setItem(token, JSON.stringify(obj))
}

// 取
const getToken = () => {
    return JSON.parse(localStorage.getItem(token))
}

// 删
const removeToken = () => {
    localStorage.removeItem(token)
}

// 导出函数
export {saveToken, getToken, removeToken}